<!--  底部导航组件 -->
<template>
	<view>
		<u-tabbar :placeholder="true" :fixed="true" :value="value" @change="name => value = name"
			:safeAreaInsetBottom="false">
			<u-tabbar-item text="首页" icon="home" name="home" @click="click"></u-tabbar-item>
			<!-- <u-tabbar-item text="功能" icon="photo" name="fun" @click="click"></u-tabbar-item> -->
			<u-tabbar-item text="个人中心" name="my" icon="account" @click="click"></u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: 'home',
				key: 'botton-nav'
			}
		},
		onLoad() {

		},
		mounted() {
			// 回显当前选中底部导航
			this.value = uni.getStorageSync(this.key);
		},
		methods: {
			click(name) {
				uni.redirectTo({
					url: '/pages/' + name + '/index'
				});
				// 设置当前选中导航到缓存
				uni.setStorageSync(this.key, name);
			}
		}
	}
</script>

<style>
</style>